package com.briup.jz.web.controller;

import com.briup.jz.bean.Carousel;
import com.briup.jz.bean.CertificationApply;
import com.briup.jz.service.ICarouselService;
import com.briup.jz.service.ICertificationApplyService;
import com.briup.jz.utils.Message;
import com.briup.jz.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@Api(description="轮播图相关接口")
@Validated
@RestController
@RequestMapping("/carousel")
public class CarouselController {

    //依赖注入
    @Resource
    private ICarouselService is;



    //更新和插入

    @ApiOperation(value = "插入轮播图")
    @PostMapping("/saveorupde")
    public Message saveorupde(Carousel carousel){

        is.saveOrUpdat(carousel);
        return MessageUtil.success("更新操作成功");
    }



    //查询
    @ApiOperation(value = "展现轮播图")
    @PostMapping("/show")
    public Message show(Long id){
        return MessageUtil.success(is.query(id));
    }



    //删除操作
    @ApiOperation(value = "删除轮播图")
    @PostMapping("/delete")
    public Message delete(Long id){
        is.deleteById(id);
        return MessageUtil.success("删除成功");
    }

}
